import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 隐私策略信息 */
export interface Privacy {
  id: number // id
  content?: string // 内容
  updateTime?: string | Dayjs // 更新者
}

// 隐私策略 API
export const PrivacyApi = {
  // 查询隐私策略分页
  getPrivacyPage: async (params: any) => {
    return await request.get({ url: `/biz/privacy/page`, params })
  },

  // 查询隐私策略详情
  getPrivacy: async (id: number) => {
    return await request.get({ url: `/biz/privacy/get?id=` + id })
  },

  // 新增隐私策略
  createPrivacy: async (data: Privacy) => {
    return await request.post({ url: `/biz/privacy/create`, data })
  },

  // 修改隐私策略
  updatePrivacy: async (data: Privacy) => {
    return await request.put({ url: `/biz/privacy/update`, data })
  },

  // 删除隐私策略
  deletePrivacy: async (id: number) => {
    return await request.delete({ url: `/biz/privacy/delete?id=` + id })
  },

  /** 批量删除隐私策略 */
  deletePrivacyList: async (ids: number[]) => {
    return await request.delete({ url: `/biz/privacy/delete-list?ids=${ids.join(',')}` })
  },

  // 导出隐私策略 Excel
  exportPrivacy: async (params) => {
    return await request.download({ url: `/biz/privacy/export-excel`, params })
  }
}
